-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EuiSuperDatePicker] Convert form control styles to Emotion #7904
Conversation
- some shenanigans rquired because of existing render fn
+ delete width Sass variables
- `noUpdateButton` requires a few per-width-type tweaks to get this working as before in prod, due to changed CSS delcaration order - `isAutoRefreshOnly` is not correctly responding to width prop on prod, this fixes that
- flatten CSS where possible (in the case of `.euiFormControlLayout__childrenWrapper`'s border-radius it is sadly not possible) - un-DRY prettyFormat CSS for now, DRY out with popover buttons later - `!important` on `.euiSuperDatePicker__rangeInput` required to offset the CSS added by `fullWidth: true` on the form control layout
+ simplify `.euiDatePopoverButton` to inherit from the form wrapper instead of reusing the static variable
- use flex for compressed height instead of static form variables - keep modifier classes for Kibana usage
- [opinionated cleanup/change] set background colors on the layout wrapper div instead of the button where possible - reuse the CSS variable and form Emotion mixins where possible as well
426d8cb
to
8146a82
Compare
component.setProps({ isPaused: true, refreshInterval: 0 }); | ||
jest.advanceTimersByTime(10); | ||
await instanceRefresh.asyncInterval!.__pendingFn; | ||
await jest.runAllTicks(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mgadewoll Your Jest upgrade PR allowed me to use this new handy util!! 🎉
8146a82
to
3abb05a
Compare
+ fix test describe name
3abb05a
to
1583a79
Compare
💚 Build Succeeded
History
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left two small comments for clarification purposes on changes but apart from that the changes look good to me!
|
||
widths: { | ||
restricted: css` | ||
${logicalCSS('width', restrictedWidth)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for clarification: I noticed there is a tiny change in width here now, that I assume is expected? I see that previously the EuiSuperDatePicker had a restricted width of 606px
and now 600px
which seems more sensible.
Screen.Recording.2024-07-23.at.14.22.37.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think the math was off with the previous Sass calculations (possibly due to flex gap?). Agreed that 600px seems more correct than 606px!
|
||
&:disabled { | ||
background-color: ${forms.backgroundDisabledColor}; | ||
color: ${forms.controlDisabledColor}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's more correct as it matches our existing form controls/fields:
It's also worth noting that there are no WCAG color contrast requirements for disabled elements/buttons: https://sean-elliott.medium.com/a11y-tips-disabled-buttons-and-colour-contrast-f8824d5e9610
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, that overall this change makes sense to align with other form controls. I was just wondering if we consider the contrast, but if that would be the case it's anyway a question on a broader level for forms I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and this way/with this change, if we change contrast levels for all form components, this component will also update automatically :)
expect(componentUpdatedRefresh.prop('isPaused')).toBe(false); | ||
const refreshButton = container.querySelector('.euiAutoRefreshButton'); | ||
|
||
expect(refreshButton).toBeInTheDocument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleanup, much nice 🧹
Going to go ahead and merge this PR to move ahead on more EuiSuperDatePicker emotion work. If you have any other change requests that I didn't fully address I can grab it in a follow-up PR! |
`v95.4.0` ⏩ `v95.5.0` _[Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_ --- ## [`v95.5.0`](https://github.com/elastic/eui/releases/v95.5.0) - Added `minusInSquare` and `plusInSquare` glyphs to `EuiIcon`. ([#7875](elastic/eui#7875)) **Bug fixes** - Fixed `EuiSuperDatePicker` not correctly passing `refreshMinInterval` from the quick select popover ([#7905](elastic/eui#7905)) **CSS-in-JS conversions** - Converted `EuiSuperDatePicker`'s form control to Emotion; ([#7904](elastic/eui#7904)) - Removed `$euiSuperDatePickerWidth` - Removed `$euiSuperDatePickerButtonWidth` - Removed `$euiSuperDatePickerNeedsUpdatingBackgroundColor` - Removed `$euiSuperDatePickerNeedsUpdatingTextColor` - Removed `@euiSuperDatePickerText` mixin - Converted `EuiSuperDatePicker`'s date popover content to Emotion ([#7908](elastic/eui#7908)) - Converted `EuiSuperDatePicker`'s quick select to Emotion ([#7909](elastic/eui#7909)) --------- Co-authored-by: Elastic Machine <[email protected]>
Summary
This PR converts EuiSuperDatePicker's form control UI to Emotion. It does not convert any of EuiSuperDatePicker's popover styles to Emotion (for ease of review - plus to help separate some extra groundwork with EuiDatePicker's variables).
QA
https://eui.elastic.co/pr_7904/#/templates/super-date-picker should look the same as production with the following permutations:
Last 30 minutes
text then click between~30 minutes ago
andnow
)Last 30 minutes
text, then~30 minutes ago
, then change tominutes from now
)Last 30 minutes
text, then~30 minutes ago
, then change toseconds ago from now
)true
to theisDisabled
control)General checklist
and screenreader modes- [ ] Added or updated jest and cypress tests[ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)Emotion checklist
General
className(s)
read as expected in snapshots and browsersUnit tests
shouldRenderCustomStyles()
test was added and passes with parent component and any nestedchildProps
(e.g.tooltipProps
)Sass/Emotion conversion process
$euiSize
toeuiTheme.size.base
)[ ] Ranyarn compile-scss
to update var/mixin JSON files[ ] Simplifiedcalc()
tomathWithUnits
if possible (if mixing different unit types, this may not be possible)[ ] Added an@warn
deprecation message within theglobal_styling/mixins/{component}.scss
file[ ] Removed component from- Not yetsrc/components/index.scss
[ ] Deleted anysrc/amsterdam/overrides/{component}.scss
files (styles within should have been converted to the baseline Emotion styles)CSS tech debt
euiCanAnimate
gap
property to add margin between items if using flex-inline
and-block
logical properties (check inline styles as well as CSS)DOM Cleanup
euiComponent
,euiComponent__child
)Kibana due diligence
**/target, **/*.snap, **/*.storyshot
for less noise) foreui{Component}
(case sensitive) to find:euiBadge
class on a div instead of simply using theEuiBadge
component) - None{euiComponent}-
(case sensitive) to check for usage of modifier classes - None for EuiSuperDatePicker, 2 for EuiDatePopoverButton[ ] If usage exists, consider converting to adata
attribute so that consumers still have something to hook intoExtras/nice-to-have
[ ] Documentation pass:[ ] Check for issues in the backlog that could be a quick fix for that component[ ] Optional component/code cleanup: consider splitting up the component into multiple children if it's overly verbose or difficult to reason about